//////////////////////////////////////////////////////////////////////////
// FileName:
// CreateBy:
// CreateDate:2010/6/2
// Description:
//		DriverBuses class
//
// Modify Log:
//
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Auto.Components;

namespace Auto.Data.BusMan.Model
{
    [Serializable]
    public class DriverBuses
    {
        #region --Field--
        ///<summary>
        ///Data Table Bus_DriverBuses
        ///</summary>
        public const string TABLENAME_Bus_DriverBuses = "Bus_DriverBuses";
        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_RecID = "RecID";
        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DriverID = "DriverID";
        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_BusID = "BusID";
        #endregion --Field--

        #region --Property--
        private int _recid;
        private string _driverid;
        private string _busid;

        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public int RecID
        {
            set { _recid = value; }
            get { return _recid; }
        }

        /// <sumary> 
        /// (DriverID Type:VarChar Len:20) 
        /// </sumary> 
        public string DriverID
        {
            set { _driverid = value; }
            get { return _driverid; }
        }

        /// <sumary> 
        /// (BusID Type:VarChar Len:20) 
        /// </sumary> 
        public string BusID
        {
            set { _busid = value; }
            get { return _busid; }
        }

        #endregion --Property--

        #region --New--
        /// <summary>
        /// Constructed Function
        /// </summary>
        public DriverBuses()
        {
            Init();
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dr">DataRow</param>
        public DriverBuses(DataRow dr)
        {
            Init();
            SetModel(dr);
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dt">DataTable</param>
        public DriverBuses(DataTable dt)
        {
            Init();
            SetModel(dt);
        }
        #endregion --New--

        #region --Private--
        /// <summary>
        /// Init The Private variable
        /// </summary>
        private void Init()
        {
            _recid = 0;
            _driverid = string.Empty;
            _busid = string.Empty;
        }
        /// <summary>
        /// SetModel By DataRow
        /// </summary>
        /// <param name="dr">DataRow</param>
        /// <returns>DriverBuses</returns>
        private DriverBuses SetModel(DataRow dr)
        {
            _recid = StrHelper.GetIntValue(dr[FIELD_RecID]);
            _driverid = StrHelper.GetStringValue(dr[FIELD_DriverID]);
            _busid = StrHelper.GetStringValue(dr[FIELD_BusID]);
            return this;
        }
        /// <summary>
        /// SetModel By DataTable
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <returns>DriverBuses</returns>
        private DriverBuses SetModel(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                SetModel(dr);
                break;
            }
            return this;
        }
        #endregion --Private--

    }
}

